<template>
  <div>
    <el-menu>
      <div v-for="(item, index) in navList.filter(menu => menu.hasOwnProperty('children') || !menu.navHide)"
           :key="index">
        <el-submenu v-if="item.hasOwnProperty('children') && item.children.length"
                    :index="item.name">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>{{item.pageName}}</span>
          </template>
          <el-menu-item v-for="(child, i) in item.children.filter(i => !i.navHide)"
                        :key="i"
                        :index="child.name">{{ child.pageName }}</el-menu-item>
        </el-submenu>
        <el-menu-item v-else
                      :index="item.name">{{ item.pageName }}</el-menu-item>
      </div>
    </el-menu>
  </div>
</template>
<script>
export default {
  name: 'navBar',
  props: {
    navList: {
      type: Array,
      required: true
    }
  },
  mixins: [],
  components: {},
  data () {
    return {
    }
  },
  created () { },
  mounted () { },
  methods: {
  }
}
</script>
<style lang='less' scoped>
</style>
